﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SceneController : MonoBehaviour
{

    [SerializeField] private GameObject enemyPrefab;
    private GameObject _enemy;

	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {
        //场景中没有敌人时才产生一个敌人
	    if (_enemy == null)
	    {
	        _enemy = Instantiate(enemyPrefab) as GameObject;
	        _enemy.transform.position = new Vector3(0, 1, 0);
	        float angle = Random.Range(0, 360);
	        _enemy.transform.Rotate(0, angle, 0);
	    }
	}
}
